package com.zleetcode.递归;

public class _A_爬楼梯 {
    public static void main(String[] args) {
        System.out.println(climbStairs(4));
    }

    private static int climbStairs(int n) {
        if (n <= 2) return n;
        int first = 1;
        int second = 2;
        for (int i = 3; i <= n; i++) {
            second = second + first;
            first = second - first;
        }
        return second;
    }
}
